package com.zhonghan.recharge.task;

import java.util.Iterator;
import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.zhonghan.common.bean.Result;
import com.zhonghan.recharge.service.BusinessRechargeService;

@Component
public class BusinessOrderTask {
	private Logger logger = Logger.getLogger(BusinessOrderTask.class);

	@Autowired
	private BusinessRechargeService businessRechargeService;
	
	 public void myJob(){
		 logger.info("businessRechargeService job  .... ");
	        /**
	         * 遍历jisumap中的数据
	         */
		List<String> myList = TaskList.Business_TASK;
		Iterator<String> iter = myList.iterator();
		while (iter.hasNext()) {
			String str = iter.next();
			String[] strs = str.split(",");
			String businessId = strs[0];
			String jiSuOrderId = strs[1];
			String outorderId = strs[2];
			String appkey = strs[3];
			logger.info(businessId + " " + outorderId + " " + jiSuOrderId+" "+appkey);
			Result result = businessRechargeService.changeMyOrderRechargeStatus(businessId, jiSuOrderId, outorderId,appkey);
			if (result != null && "1".equals(result.getCode())) {
				iter.remove();
			}
		}
	    }
}
